package com.dlc.shop.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.dlc.shop.bean.app.dto.ShopCartItemDto;
import com.dlc.shop.bean.model.SkuCombo;
import com.dlc.shop.bean.vo.SkuComboVO;
import com.dlc.shop.common.i18n.I18nMessage;
import com.dlc.shop.dao.SkuComboMapper;
import com.dlc.shop.service.SkuComboService;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 规格组合商品关联表
 * @author LGH
 */
@Service
@AllArgsConstructor
public class SkuComboServiceImpl extends ServiceImpl<SkuComboMapper, SkuCombo> implements SkuComboService {

    private final SkuComboMapper skuComboMapper;

    @Override
    public List<Long> getCombSpusByComboSpuIds(List<Long> spuIds, List<Long> skuIds) {
        return skuComboMapper.getCombSpusByComboSpuIdsOrSkuIds(spuIds,skuIds);
    }

    @Override
    public void deleteByComboSkuIds(List<Long> skuIds) {
        skuComboMapper.deleteByComboSkuIds(skuIds);
    }



    @Override
    public List<SkuComboVO> listCombSpuBySkuIds(List<Long> skuIds) {
        return skuComboMapper.listCombProdBySkuIds(skuIds, I18nMessage.getLang());
    }


    @Override
    public List<SkuComboVO> listCombProdByProdIds(List<Long> spuIds) {
        return skuComboMapper.listCombProdByProdIds(spuIds);
    }

    @Override
    public List<ShopCartItemDto> getCombShopItemsAndBySkuIds(List<Long> skuIds) {
        return skuComboMapper.listCombShopItemsAndBySkuId(skuIds);
    }

    @Override
    public List<SkuComboVO> listSkuComboVOBySkuIds(List<Long> comboSkuIds) {
        return skuComboMapper.listSkuComboVOBySkuIds(comboSkuIds);
    }
}
